 <head>
     <style type="text/css">
.post p {
margin:0 0 .75em;
line-height:1.6em;
}.csharpcode
{
font-size: small;
color: black;
font-family: Consolas, "Courier New", Courier, Monospace;
background-color: #ffffff;

}</style>
 </head>
 <h4>
     Install the Custom Tool</h4>
 <p>
     After building (VS 2008) the ULinqGen project, you may either register the 
     assembly with regasm, or build and run the setup project. Then you should close 
     the IDE (all VS2008 instances) and reopen it to make the new custom tool 
     available.</p>
 <h4>
     Code a generic Data Context class in your project</h4>
 <p>
     It may be as simple as this:</p>
    <pre class="csharpcode">    public class MyDataContext : DataContext
    {

        private static System.Data.Linq.Mapping.MappingSource 
            mappingSource = new AttributeMappingSource();

        public MyDataContext(string connection) :
            base(connection, mappingSource)
        {
        }
    }  </pre>
    <h4>
        Associate each DBML to the custom tool</h4>
    <p>
        On the project explorer, for each model in which you want to use this tool, set 
        the &quot;Custom Tool Name&quot; property to &quot;ULinqToSQLGenerator&quot;</p>
    <h4>
        Get tables from your generic data context and you are ready to LINQ</h4>
    <p>
        Assuming your DBML has an Invoice entity with InvoiceItem children and a 
        Customer foreign relation, it may look as this:</p>
    <pre class="csharpcode">    MyDataContext dc = new MyDataContext( myConnectionString);
    Table<INVOICE> invoices = dc.GetTable&lt;Invoice&gt;<INVOICE>();

    var results = from i in invoices
        where i.IsApproved
        &amp;&amp; i.Customer.FirstName.StartsWith(&quot;John&quot;)
        &amp;&amp; i.InvoiceItems.Count &gt; 2
        order by i.ApprovalDate
        select i
    return results.ToArray();</pre>
 <p>
     From here it&#39;s up to you!
 </p>
 